<?php

class TesztKitoltes extends Page {

    protected $allowedUsers = array('TEACHER', 'STUDENT');
    protected $template = 'tesztkitoltes.tpl';
    const QUESTION_TABLE = 'question';
    const DISC_TABLE = 'discipline';
    const TEST_TABLE = 'test';

    public function __construct() {
        parent::__construct();
        $this->load();
    }

    private function load() {
        $question = Dal::fetchAll(" SELECT Q.Szoveg, Q.Answer1, Q.Answer2, Q.Answer3, Q.Answer4, Q.Answer5  FROM " .
                        TesztKitoltes::QUESTION_TABLE . " Q ");

        $disc = Dal::fetchAll(" SELECT D.Name AS DName FROM " .
                        TesztKitoltes::TEST_TABLE . " T INNER JOIN " .
                        TesztKitoltes::DISC_TABLE . " D ON D.Id = T.DisciplineId ");

        $testname = Dal::fetchAll(" SELECT T.Name AS TName FROM " .
                        TesztKitoltes::TEST_TABLE . " T ");

        $this->smarty->assign('disc', $disc);
        $this->smarty->assign('testname', $testname);
        $this->smarty->assign('question', $question);
    }

}

?>